package spq

import (
	"fmt"
	"strings"
)

type Server interface {
	Concat(a,b string) (string,error)

	Diff(a,b string)  (string,error)
}

type StringServer struct {

}

func (s StringServer)Concat(a,b string) (string,error){


	return a+b,nil
}

func (s StringServer)Diff(a,b string)(string,error){
	fmt.Println("aaaaa")
	str := ""
	if len(a)>len(b){
		for _,v:=range a {
			if strings.Contains(b,string(v)) {
				str +=string(v)
			}
		}
	} else{
		for _,v:=range b {
			if strings.Contains(a,string(v)) {
				str +=string(v)
			}
		}
	}

	return str,nil
}

// ServiceMiddleware define service middleware
//type ServiceMiddleware func(Server) Server